unit u_camera;

interface

uses
  u_input,
  System.Windows.Forms,
  Microsoft.DirectX.DirectInput,
  Microsoft.DirectX.Direct3DX,
  Microsoft.DirectX.Direct3D,
  Microsoft.DirectX,
  u_form;

type

c_camera = class

  private
    myinput : c_input;
    myform : System.windows.Forms.Form;
    myf : c_form;
  public
    procedure initcam( device: device; width, height:integer; phi, teta, zoom, x, z: double);

end;


implementation

uses u_mesh;

procedure c_camera.initcam;
begin

  device.transform.view := matrix.lookatlh(Vector3.Create(zoom * sin(teta)+ x,zoom + 10,zoom * cos(teta) + z),
                                                          Vector3.Create(tiny.x, 0, tiny.y),
                                                          Vector3.Create(0, 1, 0));
  device.transform.projection := matrix.perspectivefovlh(math.pi / 4,
                                                         width / height,
                                                         0.1,
                                                         15000.0);
  myinput := c_Input.Create;
  myinput := c_input.keyandmousecreate;
  myinput.InitializeKeyboard(myform);
end;

end.
